Digital disk recorder using a port clock having parallel tracks along a timeline with each track representing an independently accessible media stream

ABSTRACT

An application programming interface for a digital disk recorder uses a port to link resources together to form a multimedia recorder that emulates a tape recorder while retaining the flexibility of the digital disk recorder. The port is a matrix of timelines for each resource, with each track in the port representing a media stream associated with a different one of the resources. A dynamic subsystem controls recording and playing back multimedia between the resources and a disk file system of the digital disk recorder using the port. A static subsystem maintains on the disk file system a database of movies recorded by the digital disk recorder from the resources according to the port, with each movie being a collection of media files for each resource that are independently accessible.

BACKGROUND OF THE INVENTION

The present invention relates to accessing and manipulating digital datafiles, and more particularly to an application programming interface fora digital disk recorder for accessing and manipulating multiple tracksof media files.

In a tape recorder different media streams, representing video, audio,time code and switching events, are bound together by the physicalnature of the medium. Each stream is represented on the tape medium as aparallel track that runs nominally along the length of the tape. Howeverin a video disk recorder each media stream/track is recorded on its own,independent file on the disk. This breaks the physical binding of thetape model, and makes editing, slipping tracks and replacing trackseasier. However to provide familiarity and ease of use it is desirableto emulate a tape recorder for operator efficiency.

SUMMARY OF THE INVENTION

Accordingly the present invention provides an application programminginterface for a digital disk recorder that uses a port to link resourcestogether to form a multimedia recorder that emulates a tape recorderwhile retaining the flexibility of the digital disk recorder. The portis a matrix of timelines for each resource. A movie is attached to eachresource along that resources timeline. The movie is in the form of acollection of media files. The port is then activated to record/playbackmultimedia as in the tape recorder. The movies are maintained as adatabase on the digital disk recorder.

The objects, advantages and other novel features of the presentinvention are apparent from the following detailed description when readin conjunction with the appended claims and attached drawing.

BRIEF DESCRIPTION OF THE DRAWING

FIG. 1 is a block diagram view of the application programming interfaceaccording to the present invention.

FIG. 2 is a state diagram view for the VDR server of the applicationprogramming interface according to the present invention.

DESCRIPTION OF THE PREFERRED EMBODIMENT

Referring now to FIG. 1 an application programming interface is shown.An operator interfaces with a computer 10 which runs applications for avideo disk recorder (VDR) 20. The computer 10 includes a file systemdriver 12 and a portion of a file server port 14, as well as a portionof a number of VDR ports 16o-16n. In the VDR 20 are correspondingportions of the file server port 24 and the VDR ports 26o-26n. The filesewer port 24 is coupled to a file server 22 which in turn is coupled toa disk file system 30. The VDR ports 26 are all coupled to a VDR server28, which in turn is coupled to a plurality of audio channels 32-0through 32-15 and a plurality of video codecs 34-0 through 34-3 for oneparticular configuration. Data is transferred between the disk filesystem 30 and the audio channels 32 and the video codecs 34. The videocodecs 34 are coupled to a plurality of video channels 36o-36n via acrosspoint matrix 38.

In operation audio data from the audio channels 32 is transferredto/from the disk file system 30 under control of the VDR server 28, andcompressed video data from the video codecs 34 is transferred to/fromthe disk file. The video data is input to and output from the videocodecs 34 in broadband format, i.e., uncompressed. The crosspoint matrix38 under command from the VDR server 28 couples each video codec 34 to aparticular one of the video channels 36. The file server 22 providesaccess to the disk file system 30 to determine where the data is to bewritten into or read from. The VDR server 28 determines for anyparticular write or read operation the source/destination from among theaudio channels 32 and the video codecs 34. The file server 22 and theVDR server 28 communicate with the computer 10 via their respective portpairs 14/24, 16/26.

There are three libraries that are used to interface programs to the VDR20: a Vdr library, a VdrConfig library and a Pdr library. The softwaremodel presented by the libraries is of two intersecting subsystems: adynamic subsystem that records and plays multimedia, i.e., a set ofmedia streams, and a static subsystem that maintains a database ofmovies, i.e., sets of relationships between recorded media. The"objects" of the Vdr subsystem have Handles, and the "objects" of thePdr subsystem have Tokens.

Every application of the computer 10 that uses the VDR 20 begins byestablishing a relationship with the system. The center of thatrelationship is a Port Clock, also known as the Port. The Port linkstogether a set of Physical Resources into a multimedia recorder. Therecorder operates on one or more streams of media, such as video, audio,timecode and events, and records those streams to media files or playsback existing media files into those media streams. The recorder'sPort's Resources are linked together and all active Resources are alldoing the same function, i.e., recording media files, playing existingmedia files or idle. Different active Resources attached to a singlePort may not be doing different things. All inactive Resources areconsidered to be idle.

Physical Resources are the inputs and outputs 32/36 of the VDR 20 andthe codecs 34 which interface the media streams to the media files onthe disks 30. Some Resources may be shared among ports and applications,while other Resources must be temporarily owned by the Port andapplication that are using them. In general input Resources may beshared, i.e., several Ports may use the same video input withoutconflict. Instead of allocating the input Resource, the application getsa connection Handle that is used in the same manner as an allocatedHandle. The codecs 34 and output Resources need to be allocated to thatPort, and the application has ownership so no other application maycause a conflict in their use.

Media files have an addressable resolution of one field of video, whichis more than a single sample of audio. The media file addresses are allpositive, starting at 0. However all of the fields of a media file neednot be recorded. A media file must be attached to a codec Resource inorder to be used with a media stream. The media file is delimited with"IN/OUT" points to be used. The IN point is that field position in themedia file which is to be used first by the codec Resource, while theOUT point is the first field position beyond the last field that is notto be used by the codec Resource. The IN/OUT points are relative to themedia file. An "attach" function automatically sets the IN/OUT points todefault values, i.e., IN=0 and OUT=N, where the highest number recordedfield in the media file is N-1.

For a new media file the default OUT point is 0 and the file is empty.Until the IN/OUT points for the attached media file are set, the filesare not used, i.e., it is merely a place-holder on a timeline withlength of 0. This means that the OUT point of a new media file must beset in order to record into the file. The file appears on the timelineto be the length specified by the OUT point. The media file that isattached to a codec Resource has a "position" on the timeline. Theposition is the relationship between the field numbers on the timelineand the field numbers in the media file. For the first media fileattached to a codec Resource the IN position is 0 on the timeline.

In the static subsystem the first object of the database is the movie.The movie is a collection of media files that are used together tocreate a multimedia activity. The movie is a static image of the mediafiles, and the files need to be moved to the dynamic subsystem of codecsand ports to be used. Movies have names and are collected into groups,which also are named. The names are merely ways of identifying themovies. The movie database is global, accessible to all Ports.

The movie has logical tracks, each track having a type and a number. Thetrack types are a subset of the Physical Resources and represent thecodecs to which the media files are attached. There is no representationof the input and output Resources of the Port. The use of logicalResources in the movie allows the movie to be recorded on one Port, andplayed correctly on a different configuration as long as theconfiguration has a similar number and type of codecs. The movie may beused on a Port with either more or fewer Resources than the Port onwhich it was recorded, or for which it was edited. It is theapplication's responsibility to determine how to map the logical tracksto Physical Resources.

To control access to the media files the database provides an indirectreference to the files by using MediaTokens. A media token representsthe media file and also contains IN/OUT points to be used for thisinstance of the media file usage. The use of the indirect referencemeans that all usages of the media file may be identified and counted,and that the media file is not inadvertently deleted while it is beingused elsewhere. To allow detection of media file usage an applicationshould not use those parts of the Vdr library that give direct access tothe file. Those parts are generally identified as Vdr functions thatrequire a file path name, or a movie name, or functions that supportthose functions.

An application program has three basic sections: two set-up sectionswhere the Resources are acquired and the media files attached, and anaction section where record and/or playback occurs. The following is ashort example for recording a movie:

    __________________________________________________________________________    //include the necessary header files.                                         #include <windows.h>                                                          #include "vdrport.h"                                                          #include "pdrmovie.h"                                                         //define some convenient values so magic numbers are not used.                #define MOVIENAME "test1"                                                     #define GROUPNAME "testgroup"                                                 #define DATA.sub.-- SET NULL                                                  #define INPUT.sub.-- NUM 0                                                    #define OUTPUT.sub.-- NUM 0                                                   #define CODEC.sub.-- NUM 0                                                    #define LOG.sub.-- TRACK.sub.-- NUM 0                                         #define MOVIE.sub.-- LEN 18000                                                #define BEFORE.sub.-- HANDLE NULL                                             #define REC.sub.-- SHUTTLE.sub.-- RATE (float)1.0                             main( )                                                                       //declare the variable to be used; Handles, Tokens, etc.                      VdrHandle port;                                                               ResourceHandle videoIn, videoOut, videoCodec                                  MediaHandle mediaHandle                                                       MovieToken movie                                                              ResourceToken track                                                           MediaToken mediaToken                                                         //set-up phase 1; open a port and configure it.                               port = VdrOpenPort( )                                                         videoIn = VdrGetResourceConnectionHandle(port,                                 ##STR1##                                                                     videoOut = VdrAllocateResource(port, ResourceVideoOut,                        OUTPUT.sub.-- NUM);                                                           videoCodec = VdrAllocateResource(port, ResourceVideoCodec,                    CODEC.sub.-- NUM);                                                            (void)VdrDefaultEvent(port, NULL, EventConnect Resources,                     videoIn, videoOut);                                                           (void)VdrDefaultEvent(port, NULL, EventConnectResources,                      videoIn, videoCodec);                                                         //set-up phase 2.                                                             movie = PdrCreateMovie(MOVIENAME, GROUPNAME)                                  track = PdrCreatResourceToken(VideoTrack, LOG.sub.-- TRACK.sub.-- NUM);       mediaToken = PdrCreateMediaToken(DATA.sub.-- SET, movie, track,                ##STR2##                                                                     mediaHandle = PdrAttachMedia(mediaToken, videoCodec,                           ##STR3##                                                                     //now start the actions.                                                      (void)VdrCueRecord(port);                                                     (void)VdrShuttle(port, REC.sub.-- SHUTTLE.sub.-- RATE);                       while(MOVIE.sub.-- LEN != VdrGetPosition(port))                                         Sleep(30);                                                          (void)VdrIdle(port);                                                          return 0;                                                                     }                                                                             __________________________________________________________________________

Each library has its own header file, and since both Vdr and Pdrlibraries are used, those header files are included. The windows.hheader file is included because it, for this example, is the computeroperating system, and every program needs it. The define statements areused so that the code has fewer magic numbers and strings, and functionparameters are more meaningful. The DATA₋₋ SET being NULL is the defaultfor using the internal disks of the disk file system. If expansion disksare available, other values of DATA₋₋ SET may be used to force the mediafile to reside on the expansion disk set. The values of INPUT₋₋ NUM,OUTPUT₋₋ NUM and CODEC₋₋ NUM are the number of the Physical Resource ofthat particular type to be used. Using 0 is only automatically valid forthe CODEC₋₋ NUM, while for the other two resources it presumes that thefirst video input and output connectors are being used, which may not bevalid. The value of LOG₋₋ TRACK₋₋ NUM is the logical track of typeVideoTrack to which the MediaToken is attached. Generally the logicaltracks are used in sequential order starting at 0. The value of MOVIE₋₋LEN is used to determine the OUT point on the media file, and thus thepoint at which the recording stops--18000 fields is approximately 5minutes for NTSC video. The value of BEFORE₋₋ HANDLE is a special caseto cause the attach to append the media file, and since for this examplethis is the only media file, there are no other files before which toinsert this file. The REC₋₋ SHUTTLE₋₋ RATE is the rate at which the PortClock advances during record. The rate is a floating point number, and1.0 means the rate is the same as the vertical synch rate of theincoming video.

During the first set-up phase the port is opened, and the Resources areacquired and linked to the port. The Vdr library looks for an availableport, so the application does not need to specify a particular port tobe opened. There are two methods for getting a ResourceHandle--theAllocation method provides an exclusive use of the Resource while theConnection method provides shared access to the Resource. Inputresources may be shared, so the videoIn Handle is acquired by getting aConnection Handle. The codec and the output need to have exclusiveaccess, so they are allocated. Next two Events are listed, where anevent is a happening relative to the Port state and Clock position. Themaking of connections is an event. The event functions may havedifferent numbers of arguments depending upon the event, i.e., aConnectResources event has only the input and the output resourcehandles while a MixAudio event has two additional parameters, the targetlevel of the input in the output as a percentage and the number offields over which to spread the change from the current level to thetarget level. The Event functions cause particular connections to bemade based on the state of the port. If the port is in Idle or Recordstate, the videoIn is connected to both the videoCodec and thevideoOutput so that the input media stream may be recorded and monitoredsimultaneously.

Having acquired the configuration for the port, the next step is toattach the media files. First a movie is created with two pieces ofinformation: its name and the name of the group into which it is to beplaced. The movie name must be unique within the group, but mayduplicate names in other groups. A group is an arbitrary division of thename space in a manner that is helpful to the application and/or user.Each group could identify a project, a user, etc. A group comes intobeing the first time a movie is placed into it, and is deleted when thelast movie in the group is deleted.

Next to create an empty media file for attachment to the codec a logicaltrack into which the MediaToken is to be placed is identified. Thatlogical track is encapsulated in the ResourceToken: it consists of theTrackType (VideoTrack) and the logical number of the track within thespecified type (LOG₋₋ TRACK₋₋ NUM). For example there may be up to 32logical tracks of each type. However for the present example with onlyfour codecs there is no value in having more tracks in a movie. TheMediaToken is created relative to the movie and logical track onto whichit is to be placed. The MediaToken contains the IN/OUT points to be usedwith this reference to the media file, and the actual path name for themedia file. The file is referenced indirectly by using the MediaToken.

The function for creating the MediaToken has as its first parameter adata set name. Where expansion disks are available, they may be treatedas separate data sets. This parameter allows placement of the media fileon the desired data set. A null value for this parameter indicates thatthe file is to be created on the internal disk set. The movie length isanother parameter for creating the MediaToken. This length is theinitial value for the OUT point in the file, and becomes the file lengthsince there is no interactive way to start and stop recording. There area couple of approaches to recording interactive programs that are beingtold when to start and stop recording. One approach is to place the OUTpoint far out in the timeline position to ensure it is beyond the end ofall recording that will be done. Then when the state is changed to Idle,the OUT point is reset to a value within the recorded material. Thesecond approach is to start with an OUT point that is slightly furtherout on the timeline than the IN point, then as the record starts toapproach the OUT point, move the OUT point forward another increment. Nodisk space is used for fields that are not recorded, as the OUT point isa control on the resource driver and not on the file system.

The last parameter for creating the MediaToken is a token already onthis same logical track of the movie. It indicates where the MediaTokenis to be attached: if it is not NULL, the new MediaToken is attachedbefore the reference MediaToken. In this example the token is NULL--thevalue NULL is returned by the function PdrNullMediaToken0. Because thetype of a MediaToken is not a redefinition of a basic compiler type, aNULL MediaToken cannot be represented by a compilable NULL. Thus theMediaToken class supplies a NULL value. When the new MediaToken is toplaced at the end of the logical track after all existing MediaTokens onthe track, or when the logical track is empty, the final parameter forcreating the MediaToken is NULL, as shown.

Having created an indirect reference to the media file, it may beattached to the dynamic timeline of the port. This is the final step inthis phase of the set-up. The function has a parameter to indicate therelative position of this media: the before MediaHandle causes an insertif it references a media that is already on the codec's timeline. If thetimeline is empty, or if the new media is to be appended at the end ofall existing media, this parameter is NULL. The shift type indicates howthe media on the timeline changes relative to the point at which thismedia is being added.

Once there are media files into which to record, the VDR 20 is ready forvideo cassette recorder (VCR) type commands, as shown in FIG. 2. Thefirst command switches the state of the port to Record mode from Idle.This causes a lot of action within the VDR as the resource drivers learnthat they need to Set ready. All of the activity is completed within afew milliseconds, and the VDR is ready to record. The record command maybe issued immediately without waiting for the state change of the VDR,and it starts as soon as it can. If it is desired to control the startof the record, it is possible to give a CueRecord command early and thenwait for a trigger condition before starting to record. Recording startswith the first field (field 1) of a frame pair after the command isissued if the CueRecord state is achieved. The recording is actuallyaccomplished by placing the PortClock in shuttle mode. In shuttle modethe clock advances its position each time the input media has a verticalsync. The amount the position is advanced is the shuttle rate: forrecording the position should advance one for one with the incomingfields and so the value 1.0 is used. Once the recording is started, thewhile loop in the code is used to know when to switch the port back toIdle state without interactive input. The program gets the currentposition of the PortClock and compares that position to the OUT point ofthe media. If the clock has not arrived at that position, the programreduces its use of resources by doing a Sleep function call. Once theOUT point has been reached by the clock, the while loop fails, and theport's state is changed to Idle.

In this next example the movie recorded above is played. The code is aseparate program, and so many of the steps of the Record program arerepeated.

    __________________________________________________________________________    //include the necessary header files.                                         #include <windows.h>                                                          #include "vdrport.h"                                                          #include "pdrmovie.h"                                                         //define some convenient values so magic numbers are not used.                #define MOVIENAME "test1"                                                     #define GROUPNAME "testgroup"                                                 #define INPUT.sub.-- NUM 0                                                    #define OUTPUT.sub.-- NUM 0                                                   #define CODEC.sub.-- NUM 0                                                    #define LOG.sub.-- TRACK.sub.-- NUM 0                                         #define BEFORE.sub.-- HANDLE NULL                                             #define PLAY.sub.-- SHUTTLE.sub.-- RATE (float)1.0                            main( )                                                                       //declare the variables to be used: Handles, Tokens, etc.                     VdrHandle port;                                                               ResourceHandle videoIn, videoOut, videoCodec;                                 MediaHandle mediaHandle;                                                      EventHandle playConnection;                                                   MovieToken movie;                                                             ResourceToken track;                                                          MediaToken mediaToken;                                                        int eventTime;                                                                int stopTime;                                                                 //setup phase1: open a port and configure it.                                 port = VdrOpenPort( )                                                         videoIn = VdrGetResourceConnectionHandle(port,                                 ##STR4##                                                                     videoOut = VdrAllocateResource(port, ResourceVideoOut,                        OUTPUT.sub.-- NUM);                                                           videoCodec = VdrAllocate Resource(port, ResourceVideoCodec,                   CODEC.sub.-- NUM);                                                            (void)VdrDefaultEvent(port, NULL, EventConnectResources,                               videoIn, videoOut);                                                  //set-up phase 2.                                                             movie = PdrGetMovieTokenFromName(MOVIENAME,                                   GROUPNAME);                                                                   track = PdrCreateResourceToken(VideoTrack, LOG.sub.-- TRACK.sub.-- NUM);      mediaToken = PdrGetNextMediaToken(movie, track,                               PdrNullMeidaToken( ));                                                        mediaHandle = PdrAttachMedia(mediaToken, videoCodec,                           ##STR5##                                                                     eventTime = VdrGetMediaStartPosition(mediaHandle);                            playConnection = VdrScheduleEvent(port,                                       eventTime,EventConnectResources,                                                          videoCodec, videoOut);                                            stopTime = VdrGetMediaMarkOut(mediaHandle)                                             VdrGetMediaMarkIn(mediaHandle) + eventTime;                          //now start the actions                                                       (void)VdrSetPosition(port, eventTime);                                        (void)VdrCuePlay(port);                                                       (void)VdrShuttle(port, PLAY.sub.-- SHUTTLE.sub.-- RATE);                      while (stopTime ! = VdrGetPosition(port))                                              Sleep(30);                                                           (void)VdrIdle(port);                                                          return 0;                                                                     }                                                                             __________________________________________________________________________

A couple of the define statements used in the Record program are notneeded in the Play program: The DATA₋₋ SET define is only needed tocreate new media files; the REC₋₋ SHUTTLE₋₋ RATE is changed to PLAY₋₋SHUTTLE₋₋ RATE; and the MOVIE₋₋ LEN define is removed because adifferent method is used for getting the ending value.

In phase 1 set-up the biggest change is in the state events. Since thePlay program does not use the port's record state, there is no effortused in setting the record connection. Also the play connection event ismoved forward into phase 2 set-up. The Play program does not need thevideoIn resource, and could technically not bother to acquire theresource or make an event to connect the resource to the videoOutresource. However it is nice to have some output during Idle state, andthe videoIn resource is shared, so it is not keeping other applicationsfrom using it.

Most of the differences in programming between the Record program andthe Play program occur in phase 2 set-up. Instead of creating a newmovie, the program asks for the token of the movie the Record programcreated. Instead of creating a new MediaToken, the Play program gets themedia token that was created by the Record program. An assumption ismade that the program knows exactly the way the movie is constructed. Itknows there is a VideoTrack logical number 0, and it knows that there isonly one MediaToken on the track.

The function PdrGetNextMediaToken is used to enumerate the media tokenson a track of a movie. The third parameter to the function is a knownMediaToken on the track being examined, or a NULL MediaToken. If theparameter is not NULL, then the MediaToken following the referencedtoken is returned. This return is a NULL MediaToken if the referenceMediaToken is the last one on the track. If the third parameter is aNULL MediaToken, then the first MediaToken on the track is returned.

After again attaching the indirectly referenced media file to the codecresource, statements are added to get the start and end clock positionsfor playing the media file. In the first statement the library returnsthe position of the media file on the timeline. The end of the mediaplay time is calculated a few statements later. This is the time atwhich a switch of state to Idle is needed. Although assumptions could bemade about both of these values based on the record program, newtechniques are used to show other capabilities of the system. Thefunction VdrGetMediaStartPosition returns the clock positioncorresponding to the IN point of the reference media file. At thatpoint, or before, an event is scheduled to switch the resourceconnection so that the codec output is connected to the videoOutresource. The events for play state are scheduled events. The event doesnot necessarily happen at the change of port state, but may be scheduledfor any point on the port timeline. The event then repeatably happenseach time the same arrangement is played. The scheduled event has oneparameter different from the state triggered events caused by theVdrDefaultEvent function: instead of a NULL, the scheduled event has aposition on the timeline at which it should happen. The reason the eventfunction is moved from phase 1 to phase 2 set-up is to wait until theposition of the media file on the timeline is known before schedulingthe event. Because there is only one media file, the position may bepredicted to be 0, but there is a better way to get the correctposition. Because the movie length is known, the test for switching fromPlay state to Idle state could be assumed, but if the IN/OUT points arechanged another technique is required. The code determines the finalposition of the port clock by getting the IN/OUT points and adding theirdifference to the position of the media.

The first action in the action section is the equivalent of a Rewindstatement that takes no time; it occurs instantaneously. The port clockposition is set to the same point that the media is attached to thetimeline, and the play event is scheduled to make the connection betweenthe codec and the videoOut resource. This action is not necessary inthis particular case because the program has just attached the mediafile, and the current position may be assumed to be 0, just as the INpoint is assumed to be 0. The second statement changes the port's statefrom Idle to Play, causing the resource drivers to get ready, i.e., theystart buffering the media files so that they have their media dataavailable when it is needed. The actual play is caused in the samemanner as the record: the port clock is told to start running and giventhe rate at which it should advance by the VdrShuttle function. The wideloop shows the use of the calculated end point instead of the assumedend point based on the length of the recorded file. Then when the endpoint is reached, the program changes the port state back to Idle.

Rather than specify resources based upon assumptions, resourceacquisitions may be handled as follows. For example since codecs aregeneric and any of the codecs may be substituted for any other, theprogram searches for an available codec.

    ______________________________________                                        #include "vdrConf.h"                                                          . . .                                                                         ResourceHandle videoCodec = 0;                                                int i = 0, limit;                                                             . . .                                                                         limit = PciGetNumCodecs(VideoCodec);                                          while (i<limit && videoCodec == 0)                                            {        videoCodec = VdrAllocateResource(port,                               ResourceVideoCodec, i);                                                              i++;                                                                   if (videoCodec == 0)                                                          { //now process the error of no video codec available.                        }                                                                             ______________________________________                                    

By adding a couple of new variables to control a loop through the codecsand adding a call to the Pci function to set the limit of the loop, thecode is improved. The vdrConf library allows more independence betweencode and hardware configuration by allowing symbolic names to be usedfor the input and output resources. The only requirement is that, ifsomeone changes the connections to the VDR, the resource names need tobe changed to match.

The resources may be assigned symbolic names as follow:

    __________________________________________________________________________    . . .                                                                         #define IN.sub.-- NAME "feed1"                                                #define OUT.sub.-- NAME "monitor3"                                            #define MAX.sub.-- NAME 10                                                    . . .                                                                         ResourceHandle videoIn = 0, videoOut = 0                                      int i = 0, limit;                                                             char name[MAX.sub.-- NAME];                                                   . . .                                                                         limit = PciGetNumInputs(VideoInput);                                          while (i<limit && videoIn == 0)                                               {        if (PciGetInputName(VideoInput, i, name, MAX.sub.-- NAME) &&                  (strcmp(name, IN.sub.-- NAME) == 0))                                          {    videoIn = VdrGetResourceConnectionHandle(port,                                     ResourceVideoIn, i)                                                 }                                                                             i++;                                                                 i = 0;                                                                        limit = PciGetNumOutputs(VideoOutput);                                        while (i<limit && videoOut == 0)                                              {        if (PciGetOutputName(VideoOutput, i, name, MAX.sub.-- NAME)          &&                                                                                     (strcmp(name,OUT.sub.-- NAME) == 0)                                           {    videoOut = VdrAllocateResource(port,                            ResourceVideoOut, i);                                                                  }                                                                             i++;                                                                 }                                                                             if (videoIn == 0 | | videoOut == 0)                         {        //process the error; couldn't get the resource.                      }                                                                             __________________________________________________________________________

This fragment assumes that vdrConf. h is still included. It defines afew new constats and variables, and is similar to the code for gettingthe codec with the addition of a name comparison. The "if" statementfirst trys to act the ith name from the library and, if it is able toact the name, it compares the name to the desired name string as givenin the define statement. At the end there is a test to make certain theresources are available, and could include the test for the codec aswell.

Thus the present invention provides an application programming interfacefor a digital disk recorder by using a port to link resources togetherto form a multimedia recorder, by attaching a movie in the form of acollection of media files to the port, and by activating the port torecord/playback multimedia.

What is claimed is:
 1. An application programming interface for adigital disk recorder comprising:a dynamic subsystem for recording andplaying back multimedia between resources and a disk file system of thedigital disk recorder, the dynamic subsystem having a port clock forlinking the resources together, the port clock having a plurality ofparallel tracks along a timeline, each track representing a media streamand being associated with a different one of the resources and eachmedia stream representing at least one media file; a static subsystemfor maintaining on the disk file system of the digital disk recorder adatabase of movies recorded by the multimedia recorder from theresources according to the port clock, each movie being a collection ofmedia files for each resource that are independently accessible.
 2. Amethod of application programming a digital disk recorder comprising thesteps of:opening a port clock, the port clock being in the form of aplurality of parallel tracks along a timeline, each track representing adifferent media stream of at least one media file; coupling a pluralityof resources to the port clock, each resource being coupled to adifferent one of the tracks to provide the media stream for that track;attaching a movie to the port clock, the movie being in the form of acollection of media files for each resource and being stored in a diskfile system of the digital disk recorder; and activating the port clockto record/play the movie.